package Test;

import Util.JdbcUtil;

import java.sql.Connection;

public class JdbcUtilTest {
    public static void main(String[] args) {
        // 测试获取数据库连接
        Connection connection = JdbcUtil.getConnection();
        if (connection != null) {
            System.out.println("数据库连接成功！");
            try {
                connection.close(); // 关闭连接
                System.out.println("数据库连接已关闭。");
            } catch (Exception e) {
                System.out.println("关闭连接时出错: " + e.getMessage());
            }
        } else {
            System.out.println("数据库连接失败！");
        }
    }
}
